import java.util.Scanner;

public class demo3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入起始数字：");
        int start = sc.nextInt();
        System.out.print("请输入结束数字：");
        int end = sc.nextInt();

        int count = 0;
        for (int i = start; i <= end; i++) {
            boolean flag = true;
            for (int j = 2; j < i; j++) {
                if (i % j == 0) {
                    flag = false;
                    break;
                }
            }
            if (flag){
                System.out.println(i+"为质数");
                count++;
            }
        }
        System.out.println("一共有"+count+"个质数");
    }
}
